package com.tanhua.model.vo;

import com.tanhua.model.mongo.Dimension;
import com.tanhua.model.mongo.Report;
import com.tanhua.model.mongo.SimilarYou;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * 返回报表vo类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReportVo {
    private String id;    //报告id
    private Long userId;    //用户id
    private String questionnaireId; //问卷id
    private String conclusion;  //鉴定结果
    private Double score; //问卷得分
    private String cover;   //封面
    private List<Dimension> dimensions;  //维度值
    private List<SimilarYou> similarYou; //与你相似；

    public static ReportVo init(Report report, List<Dimension> dimensions, List<SimilarYou> similarYou) {
        ReportVo vo = new ReportVo();
        BeanUtils.copyProperties(report, vo);
        vo.setId(report.getId().toHexString());
        vo.setQuestionnaireId(report.getQuestionnaireId().toHexString());
        vo.dimensions = dimensions;
        vo.similarYou = similarYou;
        return vo;
    }
}
